<?
//[string or array ] _typeof(alltype ar,string rettype);返回一个变量的类型
function _typeof($ar1,$rettype="array"){
    if($rettype=="array"){
	    if(is_scalar($ar1) ){$scalar="scalar";}else{$scalar="notscalar";}
	    if(is_array($ar1)){return array("array",$scalar);}
	    if(is_bool($ar1)){return array("bool",$scalar);}
	    if(is_float($ar1)){return array("float",$scalar);}
	    if(is_integer($ar1)){return array("integer",$scalar);}
	    if(is_null($ar1)){return array("null",$scalar);}
	    if(is_numeric($ar1)){return array("numeric",$scalar);}
	    if(is_object($ar1)){return array("object",$scalar);}
	    if(is_resource($ar1)){return array("resource"."|".get_resource_type($ar1),$scalar);}
	    if(is_string($ar1)){return array( "string",$scalar);}
	    return array("unknow type");
    }else{
	    if(is_array($ar1)){return "array" ;}
	    if(is_bool($ar1)){return "bool" ;}
	    if(is_float($ar1)){return "float" ;}
	    if(is_integer($ar1)){return "integer" ;}
	    if(is_null($ar1)){return "null" ;}
	    if(is_numeric($ar1)){return "numeric" ;}
	    if(is_object($ar1)){return "object" ;}
	    if(is_resource($ar1)){return "resource"."|".get_resource_type($ar1) ; }
	    if(is_string($ar1)){return  "string" ;}
	    return "unknow type";
    }
}
function _sbslash2f ( $str ) {  return  str_replace ( '\\' , '/' , $str )  ; /*_sbackslash2forward*/ }
function _xfslash2one ( $str ) {  return  preg_replace ( '/\/{1,}/' , '/' , $str )  ;   }
//*贪婪模式 *  尽可能多的匹配       非贪婪 *?  此处是贪婪模式
//*贪婪模式\/{1,}  尽可能多的匹配       非贪婪\/{1,}?  此处是贪婪模式
function _sbslash ( ) {  return  DIRECTORY_SEPARATOR  ;  }
function _getcwd ( ) {  return _sbslash2f ( getcwd( ) ); }
function _default_un( $ar1 , $ar2 ){  if($ar1=="un"){ return $ar2;}else{ return $ar1 ;}  }
function _default_em( $ar1 , $ar2 ){ if(count($ar1)==0 or empty($ar1)){ return $ar2;}else{ return $ar1 ;}  }
function _str2href($value){return '<a href="?dir='.$value.'" target="_self"> '.$value.'</a>' ;}
function _str2href_x($value){return '<a href="?filename='.$value.'&dir='._default_em($_REQUEST["dir"],"I:/AppServ/www/_doll/").'" target="_self"> '.$value.'</a>' ;}
function _str2href_x2($value){return '<a href="_hl.php?filename='.$value.'&dir='._default_em($_REQUEST["dir"],"I:/AppServ/www/_doll/").'" target="_self"> '.$value.'</a>' ;}
function _htmlspecialchars($str,$x="no"){
    switch ($x)
    {
case "ds":
  return htmlspecialchars($str, ENT_QUOTES);
  break;
case "s":
  return htmlspecialchars($str, ENT_COMPAT);
  break;
case "no":
   return htmlspecialchars($str, ENT_NOQUOTES);
   break;
default:
   return htmlspecialchars($str, ENT_NOQUOTES);
    }
}
function _chars($string) {
	if(is_array($string)) {
		foreach($string as $key => $val) {
			$string[$key] =$val ;
		}
	} else {
	$string =str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $string);
	}
	return $string;
}
function _arr_chars($arr){
    $retarr=array();
    foreach($arr as $k=>$v){
    $retarr[]=	 (_chars($v));
    }	
	return $retarr;
}
function _arr_chars_callback($arr,$cb="_arr_chars_cbfx"){
    $retarr=array();
    foreach($arr as $k=>$v){
    $retarr[]=	 $cb(_chars($v));
    }	
	return $retarr;
}


function _getcc_dirs($arr='un'){
	//_get_c_complete_dirs
	$arr=_default_un(  $arr,_get_cu_dirs( ) );
    $retarr = array();
	foreach($arr as $k=>$v){
	    if("cwd"!=$k){
		    $retarr[] = _xfslash2one ($arr["cwd"]."/".$v) ;
		}	
	}	
	$retarr[cwd] = (_xfslash2one ($arr["cwd"]."/"));
	return $retarr;
}

function _getcc_dirs_fx($arr='un'){
	//_get_c_complete_dirs
	$arr=_default_un(  $arr,_get_cu_dirs( ) );
    $retarr = array();
	foreach($arr as $k=>$v){
	   if("cwd"!=$k){
		    $retarr[] = _xfslash2one ($arr["cwd"]."/".$v) ;
		}	
	}	
	 array_shift($retarr);
	return $retarr;
}


function _getcc_dirs_href($arr='un'){
	//_get_c_complete_dirs
	$arr=_default_un(  $arr,_get_cu_dirs( ) );
    $retarr = array();
	foreach($arr as $k=>$v){
	    if("cwd"!=$k){
			$value=_xfslash2one ($arr["cwd"]."/".$v);
		    $retarr[] =_str2href($value);
		}	
	}	
	$retarr[cwd] =_str2href(_xfslash2one ($arr["cwd"]."/"));
	return $retarr;
}

function _getcc_files_href($cb='_str2href_x',$arr='un'){
	//_get_c_complete_dirs
	$arr=_default_un(  $arr,_get_cu_files( ) );//用_get_cu_files( )这个函数少一轮循环，用_get_cu_files( )多一轮
    $retarr = array();
	foreach($arr as $k=>$v){
	    if("cwd"!=$k){
			$value=_xfslash2one ($arr["cwd"]."/".$v);
		    $retarr[] =$cb($value);
		}	
	}	
	$retarr[cwd] =_str2href(_xfslash2one ($arr["cwd"]."/"));
	return $retarr;
}


function _getcc_files($arr='un'){
	//_get_c_complete_files
	$arr=_default_un(  $arr,_get_cu_files( ) );
    $retarr = array();
	foreach($arr as $k=>$v){
	    if("cwd"!=$k){
		    $retarr[] = _xfslash2one ($arr["cwd"]."/".$v) ;
		}	
	}	
	return $retarr;
}

function _get_cu_dirorfile_names(){
	$dir = dir("./");
	$retarr = array( ) ;
    while (($file = $dir->read()) !== false)
    {  $retarr[] = _sgb2utf8($file) ;  }	
	//$dir->rewind();
	$dir->close();
	$retarr["cwd"]=_getcwd();
	return $retarr;
}
function _dir($str){
    $dir = dir($str);
	$retarr = array( ) ;
    while (($file = $dir->read()) !== false)
    {  $retarr[] = _sgb2utf8($file) ;  }	
	$dir->close();
	$retarr["cwd"]=_getcwd();
	return $retarr;	
}
function _get_up_dirorfile_names(){
	$dir = dir("../");
	$retarr = array( ) ;
    while (($file = $dir->read()) !== false)
    {  $retarr[] = _sgb2utf8($file) ;  }	
	$dir->close();
	$retarr["cwd"]=_getcwd();
	return $retarr;
}
function _sgb2utf8($str){
	if(function_exists("iconv")){
         return iconv('GB2312','UTF-8//IGNORE', $str)  ;	
	}else{  return $str ; }
}

function _get_cu_dirs( $arr="un" ){
	$arr=_default_un(  $arr,_get_cu_dirorfile_names()  );
	$retarr = array();
    foreach($arr as $k=>$v){
		if( is_dir( $v ) ){  $retarr[$k] = $v ;  }
	}
	return $retarr;	
}
function _get_cu_files( $arr ="un" ){
	$arr=_default_un(  $arr,_get_cu_dirorfile_names()  );
	$retarr = array();
    foreach($arr as $k=>$v){
		if(! is_dir( $v )||$k=="cwd" ){  $retarr[$k] = $v ;  }
	}
	return $retarr;	
}

function _get_up_dirs( $arr="un" ){
	$arr=_default_un(  $arr,_get_up_dirorfile_names()  );
	$retarr = array();
    foreach($arr as $v){
		if( is_dir( $v ) ){  $retarr[] = $v ;  }
	}
	return $retarr;	
}
function _get_up_files( $arr ="un" ){
	$arr=_default_un(  $arr,_get_up_dirorfile_names()  );
	$retarr = array();
    foreach($arr as $k=>$v){
		if(! is_dir( $v ) ||$k=="cwd"){  $retarr[] = $v ;  }
	}
	return $retarr;	
}
function _bat_mkdir_fx($matches,$target="D:/"){
	$stauts= $target;
	foreach($matches[1] as $v){
		$stauts=$stauts.($v."/");
        if(!file_exists($stauts) or !is_dir($stauts) or true){
			echo($stauts."<br>");
			$r=@mkdir($stauts,0777);
			echo $r?"ok<br>":"error<br>";
	    }	
	}
	return $stauts;
}

function _bat_mkdir($comdir,$filename,$target="D:/"){
	preg_match_all("/\/{1,}([^\/]{1,})/",$comdir,$ms);
	$newdir=_bat_mkdir_fx($ms,$target);
	//echo copy($filename,$newdir.basename($filename))?'<span style="color:  #F63;">写入成功</span>':'<span style="color:  #F63;">写入失败</span> ';
	
}
function _dirinfo($path="."){
return array("basename"=>basename	($path),
                   "dirname"=>dirname	($path),
				    "files"=>_getcc_files(),"dirs"=> _getcc_dirs()
				   );
}
 
function _mktablesource()
{
return "<pre>"._htmlspecialchars('<table id=tab  width="100%" border="0" cellspacing="1" cellpadding="5" bordercolor="#333">
  <tr>
    <td scope="col" width="50%"></td>
    <td width="50%"></td>
  </tr>
</table>

#tab{
	margin:0px auto;
	position:relative;
	color:#fff;
	font-size:40px;
	font-family:Verdana, Geneva, sans-serif;
	background-color:#112211;/*zhongyao*/
	}
#tab tr td{
	overflow:hidden;
	word-break:break-all;
}
#tab tr{
	background-color:#2e4d3e}')."</pre><span style='color:#2e4d3e;font-size:70px;'><b>#tab background-color:#2e4d3e</b></span><br><span style='color:#112211;font-size:70px;'><b>#tab tr background-color:#112211</b></span>";
}


// array  _scandir (  string $path , int  $sorting_order ) ;
// 返回 array( 目录完全路径组成的数 ，文件全路径组成的数组 ，不带路径的文件和目录数组 );
// 举例 _scandir (  'I:/Appserv/' , 1 ) ;
function _scandir (  $path = 'empty' , $sorting_order = 0  ){
	global $c;
    if ( 'empty' == $path || $path == '' ) { $path = getcwd () ; } // $path= .  或  ./    都可以 ;
    $arr=scandir ( $path , $sorting_order ) ;         //sort()升序  rsort()降序 ;
	//$arr=_scan($path);
    $arrfiles = array ( ) ;    $arrdirs = array( ) ;
    foreach ( $arr as $k => $v ) {    $c->j++;
		$completev=$path.'/'.$v;//给文件目录加上路径，例：image 变为 I:/Appserv/image/
		$completev=preg_replace ( '/\/{1,}/' , '/' ,     str_replace ( '\\' , '/' , $completev )    ) ;
		if( !preg_match("/\.{1,2}[\/]*$/",$completev) )
        {      if ( is_dir($completev ) ) 
              { $arrdirs[$k] = preg_replace ( '/\/{1,}/' , '/' ,  $completev.'/'  ) ; }
              else    
              { $arrfiles[$k] = $completev ;}
		}else{  $root[]=preg_replace ( '/\/{1,}/' , '/' ,  $completev.'/'  ) ;  }
    }
	$arrdirs[cwd]=$arrfiles[cwd]=$arr[cwd]=preg_replace ( '/\/{1,}/' , '/' ,   $path.'/'  );
    $retarray = array ( 'dirs' => $arrdirs ,'files' => $arrfiles ,  'root' => $root , 'arr' => $arr 
                           , 'path' => $path.'/' , 'sorting_order' => $sorting_order  ) ;
						 
return $retarray ;
}

function _scan($path){
	$dir = dir($path);
	$retarr = array( ) ;
    while (($file = $dir->read()) !== false)
    {  $retarr[] =  ($file) ;  }	
	$dir->close();
	$retarr["cwd"]=_getcwd();
	return $retarr;
}
class CLdir{
	 function __construct(){echo 'construct';}
	 
      public $num=0;
	  public $j=0;
	  public $dir   ;
	  function show(){echo 'show';}
      public function scandir($dirs){
		 $this->num++; 
	    return  _scandir($dirs) ; 
		 }	
		 function __destruct(){echo 'destruct';}
 
}

function _array_pagination_style($color='#0066cc',$clstr='.pagehref',$size=20){
	$str="<style>".chr(10);
	$str.=str_repeat('  ',2).$clstr.' a{'.chr(10);	
	$str.=str_repeat('  ',2).'font-weight:bold; '.$color.' ;'.chr(10);
	$str.=str_repeat('  ',2).'border:solid 1px; '.$color.' ;'.chr(10);
	$str.=str_repeat('  ',2).'font-size: '.$size.' px;'.chr(10);
	$str.=str_repeat('  ',2).'color:'.$color.';'.chr(10);
	$str.=str_repeat('  ',2).'text-decoration:none;'.chr(10);
	$str.=str_repeat('  ',2).'background-color:#fff;'.chr(10);
	$str.=str_repeat('  ',2).'padding:2px 10px 2px 10px;'.chr(10);
	$str.=str_repeat('  ',2).'margin:0px 2px 0px 2px;'.chr(10);
	$str.=str_repeat('  ',2).'overflow:hidden; line-height:200%;'.chr(10);
	$str.=str_repeat('  ',2).'}'.chr(13);
	$str.=str_repeat('  ',2).$clstr. ' a:hover{'.chr(10);
	$str.=str_repeat('  ',2).'background-color:'.$color.';'.chr(10);
	$str.=str_repeat('  ',2).'font-weight:bold;'.chr(10);
	$str.=str_repeat('  ',2).'color:#FFFFFF;'.chr(10);
	$str.=str_repeat('  ',2).'}'.chr(10);
	$str.=str_repeat('  ',2).$clstr. '{'.chr(10);
	$str.=str_repeat('  ',2).'font-size:'.$size.'px;'.chr(10);
	$str.=str_repeat('  ',2).'color:'.$color.';'.chr(10);
	$str.=str_repeat('  ',2).'margin:0px 0px 0px 0px;'.chr(10);
	$str.=str_repeat('  ',2).'}'.chr(10);
	$str.=str_repeat('  ',2).$clstr.' input {'.chr(10);
	$str.=str_repeat('  ',2).'height:14px;'.chr(10);
	$str.=str_repeat('  ',2).'border:solid 1px'.$color.';'.chr(10);
	$str.=str_repeat('  ',2).'}'.chr(10);
	$str.='</style>'.chr(10);
	return $str;
}

//current page 当前页面
//total number of records 总记录数
//pagesize页面大小
//Number of links 链接数目
//request parameter
//intarray(当前页，数组的长度即总记录
//数，)

//$array要分页显示的数组
//$nCurrentPage当前页
//&$content当前显示数的内容
//$url 当前页面的url
//$requestParas='&' 例如 &str=dfadf&action=del
//$pageSize 每页显示的记录数，每页显示数组的多少项
//显示的链接数量  首页 第一页 1 2 3 4 5 6 7 8 9 10 11 末页
//此例中$numberOfLinks=11
function _array_pagination($array,$nCurrentPage=2,&$content,$url='',$requestParas='&',$pageSize=50,$numberOfLinks=8,$totalNumberOfRecords='empty'){
	if(empty($array)){$array=array(count($array),'Is not a array!');}
	$tNORes=$totalNumberOfRecords=='empty'? count($array) : $totalNumberOfRecords;
	
    //$nCurrentPageMax=ceil( count($array) / $pageSize );
	$nCurrentPageMax=ceil( $tNORes / $pageSize );
	
	$nCurrentPage =  preg_replace("/[^0-9]{0,}/","",$nCurrentPage);
	 
	 
	$nCurrentPage = ( empty($nCurrentPage) )? 6 : $nCurrentPage ;
	if($nCurrentPage>$nCurrentPageMax){$nCurrentPage=$nCurrentPageMax;}
	$ret='';
	$nL=($nCurrentPage-floor($numberOfLinks/2)-1);//$nL 为nLinkValutStart;
	
	$arrKeyStart=($nCurrentPage-1)*$pageSize;
	
	/*for ($j=0;$j<$pageSize;$j++){
		if($arrKeyStart+$j<count($array)){
	$content[]= '['.($arrKeyStart+$j).']->'.$array[($arrKeyStart+$j)]."</br>";	
		}
	}*/
	$ic=0;
	
	foreach($array as $k => $v){
		if($arrKeyStart<=$ic and $ic<$arrKeyStart+$pageSize and $ic<count($array)){
	    $content[$k]=$v."<br>";
		}
		$ic++;		
	}
	$content['sql']=' limit '.$arrKeyStart.', '.$pageSize;
	
	$firstUp='<a href="'.$url.'?page=1'.$requestParas.'" blank="_self" >首页</a>'."\n";
	if($nCurrentPage>1){
	$firstUp.='<a href="'.$url.'?page='.($nCurrentPage-1).$requestParas.
	'" blank="_self" >上一页'.($nCurrentPage-1).'</a>'."";
	}
	
	
 
    $countOutLinksNum=0;//计算输出的链接数
	$startLinkVal='empty';//计算第一个链接的page值
	$endLinkVal='empty';//计算最后一个链接的page值
    for ($i=1;$i<$numberOfLinks+1;$i++){
	
	    if(($nL+$i)==$nCurrentPage){$style="style='background-color:#0066cc;color:#fff'";}else {$style="";}
	
	    
	    if(($nL+$i)>0 and ($nL+$i)<=$nCurrentPageMax){
		$ret=$ret.'<a '.$style.' href="'.$url.'?page='.($nL+$i).$requestParas.'" blank="_self" >'
	    .($nL+$i).'</a>'."" ;
		 $startLinkVal=="empty"?$startLinkVal=$nL+$i: true ;
		 $endLinkVal=$nL+$i;
		$countOutLinksNum++;
		}
		 
		
    }
	
	$arrayLeftLinks=array();//补左边空缺的链接，变量是左边空缺链接的具体内容
	for($k=1;$k<= $numberOfLinks- $countOutLinksNum ;$k++){		
        if(($startLinkVal-$k)>0){
	$arrayLeftLinks[]='<a href="'.$url.'?page='.($startLinkVal-$k)
	.$requestParas.'" blank="_self" style="color:red;" >'
	.($startLinkVal-$k)."</a>";	
		}
	
	}
	$arrayLeftLinks=implode(  "" , array_reverse($arrayLeftLinks) );
	
	$arrayRightLinks=array();//补右边空缺的链接，变量是右边空缺链接的具体内容
	for($k=1;$k<= $numberOfLinks- $countOutLinksNum ;$k++){	
	if($nCurrentPage < ceil($numberOfLinks/2) )
	    if($endLinkVal+$k<$nCurrentPageMax){
	        $ret=$ret.='<a href="'.$url.'?page='.($endLinkVal+$k)
	        .$requestParas.'" blank="_self" style="color:green;" >'
	        .($endLinkVal+$k)."</a>";	
		}
	}
	
	
	$ret=$firstUp.$arrayLeftLinks.$ret;
	if($nCurrentPage<$nCurrentPageMax){
	$ret=$ret.'<a href="'.$url.'?page='.($nCurrentPage+1).$requestParas.
	'" blank="_self" >下一页'.($nCurrentPage+1).'</a>'."";
	}
	$autogo='<kbd><input type="text" name="custompage" size="3" style="height:28px; font-size:20px;" onkeydown="if(event.keyCode==13) {window.location=\'' . $url .'?'.$requestParas.'&page=\'+this.value; return false;}" /></kbd>';
	
	$ret=$ret.'<a href="'.$url.'?page='.($nCurrentPageMax).$requestParas.
	'" blank="_self" >末页'.($nCurrentPageMax).'</a>'.$autogo._debug("\n\$countOutLinksNum:<b>"
	.$countOutLinksNum."</b>|\$startLinkVal:<b>".$startLinkVal."</b>|\$endLinkVal:<b>".$endLinkVal."</b>",5);
	
	//"<form method=get> 转<INPUT id='heig' TYEP=TEXT NAME=page SIZE=2 Maxlength=5 VALUE=1  >页<INPUT id='heig1'    type=submit value=GO></form>";
	
	return '<div class="pagehref">'.$ret.'</div>';
}


function _array_fill_table($arr,$sWidth="65px",$t=false){
    if(!is_array($arr)){$arr = array('Is not array!');}	
	$i=1;
	echo '<table   border="0" cellspacing="0" cellpadding="0" >';
	foreach($arr as $k=>$v){
	if($t){
	echo $v;
	}else{
		if( ($i%2)==0){$bgcolor="#f0f0f0;";}else{$bgcolor="#fcfcfc;";}
			echo "<tr ><td  class='num' style='display:block;color:#999;font-size:18px;width:".$sWidth.";overflow:hidden;'><b>".$k
."</b></td><td style='border-color:#33cc33;width:4000px; border-left-style:solid; border-left-width:4px;".
			"height:12px; padding-left:2px;background-color:".$bgcolor."'>".$v."</td></tr>";
		}
		$i++;
	}
	echo "</table>";
}


function _mkcstr($str){
   return new Clstring($str);	
}
class Clstring{
	public $string;
    public function __construct($str){
		$this->string=$str;
	}
	public function Val(){
		return $this->string;
		}
	public function High($color="#f90",$size=20){
		$this->string=
		 '<span style="color:'.$color
		.';font-size:'
		.$size.'px;">'.$this->string.'</span>';
		return $this;
	}
	public function Fast($color="#f90",$size=20){
	    $this->High($color,$size)	;
		return $this->Val();
	}
	public function __destruct(){
		$this->string=NULL;
	}
	public function Add($str){
	   	$this->string.=$str;
		return $this;
	}	
}

class Clfn
{
    public $root;
	public $httpdRoot;
	public $fileUrls;
    public function __construct($path=""){
		$this->root=Clfn::chSlashs($path);
		$this->fileUrls = array();
		 
	}
	//$path 一般传入 __FILE__
	public static function chSlashs ($path=""){
		$path=preg_replace 
			( 
			array('/\/{1,}/'), 
			array('/'       ),
					   str_replace( 
					   '\\',
					   '/' , 
						str_replace('//','/',dirname($path).DIRECTORY_SEPARATOR)
					   )   
			);
	
		return $path;
	}
	public function __destruct(){
	}
	public function requireOnce($arrOrStr){
		if(is_array($arrOrStr)){
			foreach($arrOrStr as $v){
			    require_once($this->root.$v)  ;
			}	
			return;
		}
		if(is_dir($arrOrStr)){
			$this->requireDirOnce($arrOrStr);
			return;
			
		}
		if(!empty($arrOrStr)){
			require_once($this->root.$arrOrStr);
		}
		
		
	}
	//$suffix 例如等于 "../../"."inc/"
	//通过路径包含php文件一次
	public   function requireDirOnce($suffix=''){	
	    $bool=function_exists('_debug');	
		$s=new clscandir($this->root.'/'.$suffix);
		$arr=$s->get_complete_files();	
		
		if($bool){
			foreach($arr as $v){
				if(preg_match("/\.php$/",$v) ){
			    echo _debug( _mkcstr("require_once('".$v."')</br>")->High('red',16)->Val() , 3 );			    }
			}	
		}
		foreach($arr as $v){
			if(preg_match("/\.php$/",$v) ){
			require_once($v) ;		
			}
		}
		
	}
	
	public function getHttpdRoot($str=""){
		if($str==""){return "";}
		$sRet=str_replace($str,"",$this->root);
		$this->httpdRoot=$sRet;
	    return  $this->httpdRoot;	
	}
	
	public function filePathToUrl($filePath=""){
		if($filePath==""){return "";}
	    $server_url=Clfn::iGetServerUrl();
		$ret = str_replace(
		$this->httpdRoot,$server_url,$filePath);
		$this->fileUrls[]=$ret;
		return $ret;
	}
	
	//internal 使用 
	public static function iGetServerUrl(){
        return 	"http://".$_SERVER[SERVER_NAME]
		.":".$_SERVER[SERVER_PORT]."/";
	}
	public static function echoarr($arr){
		if( !is_array($arr) ){ return false;}
		foreach($arr as $v){
		    echo $v."\n";	
		}
	}
	public static function resz($num ,$rate=1){
		
		return  ceil($num * $rate) ;
	}			
}

class Clbase
{
	public $className ;
	
	public function __construct(){
		$this->className = Clbase;
	}	 
	
	public function getVars($className="")
    {
		if($className!=""){
		    return get_class_vars(get_class($className));
		}
        return get_class_vars(get_class($this));
    }
	
	public  function  getMethods($className="")
	{
		if(!!empty($className)){
		    $className = $this->className;
		}
		return get_class_methods($className);		
	}
	
	public static function formatVars($arr){
		$arrRet = array();
		foreach($arr as  $k=> $v){
		$arrRet[] = $k;    
		}
		return $arrRet;
	}
	
	public function getVarsString($obj){
		$vars= ClscriptInfo::formatVars($obj->getVars($obj));
        return "<pre>".ClscriptInfo::arr2str($vars,"\n")."</pre>"  ;
	}
	
	public function getMethodsString($obj){
		$vars=  $obj->getMethods($obj) ;
        return "<pre>".ClscriptInfo::arr2str($vars,"\n")."</pre>"  ;
	}
	
	public static function arr2str($arr,$arg2="--"){
        return implode($arg2,$arr);
    }

	public function __destruct(){}	
}
class Cldate
{
    public static function getDate(){
	    date_default_timezone_set('PRC');
		return date("Y-m-d,H:i:s",time());	
	}	
}
if(!function_exists("get_magic_quotes_gpc")){
function get_magic_quotes_gpc(){
    return false;
}
}
?>
 